//
// Unihan Input Method
//
// Copyright © 2002-2007 Sun Wah Linux Ltd.
//
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
// USA
//
// $Id: common.c 757 2007-05-10 08:19:31Z roger $
//

#include <unistd.h>
#include <stdio.h>
#include <unihan_im_keycodes.h>
#include <unihan_im.h>

#include "common.h"
#define DEBUG_SYM 0

SymbolUserTable *
get_SymUser(SymbolUserTable *sut, int numSut, int modifier, int keyCode)
{
	SymbolUserTable *pSut = sut;
	int i;
	int found = FALSE;

	for (i=0; i<numSut; i++) {
		if ((modifier == pSut->modifier) && (keyCode == pSut->keyCode)){
			found = TRUE;
			break;
		}
		pSut++;
	}
	if (found)
		return pSut;
	else
		return NULL;
}

SymbolUserTable *
init_SymUserTable(SymbolUserTable *sut, int numSut)
{
	return NULL;
}

WordUserTable *
get_WordUser(WordUserTable *wut, int numWut, char *key)
{
	WordUserTable *pWut = wut;
	int i;
	int found = FALSE;

	for (i=0; i<numWut; i++) {
		if (strstr(wut[i].key, key) == wut[i].key){
			found = TRUE;
			break;
		}
		pWut++;
	}
	if (found)
		return pWut;
	else
		return NULL;
}

WordUserTable *
get_exact_WordUser(WordUserTable *wut, int numWut, char *key)
{
	WordUserTable *pWut = wut;
	int i;
	int found = FALSE;

	for (i=0; i<numWut; i++) {
		if (strcmp(wut[i].key, key) == 0){
			found = TRUE;
			break;
		}
		pWut++;
	}
	if (found)
		return pWut;
	else
		return NULL;
}

// vi:ts=4:nowrap:cin:expandtab
